package com.woniuxy.microstockserver.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.microstockserver.bean.PageRequestBean;
import com.woniuxy.microstockserver.bean.StockDetailBean;
import com.woniuxy.microstockserver.mapper.StockDetailMapper;
import com.woniuxy.microstockserver.service.IStockDetailService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author 赵雄伟
 * 商品库存明细impl
 */
@Service
public class StockDetailServiceImpl implements IStockDetailService {
    @Resource
    private StockDetailMapper stockDetailMapper;
    @Override
    public PageInfo<StockDetailBean> findAllStockDetailBean(PageRequestBean pageRequestBean, StockDetailBean stockDetailBean) {
        return PageHelper.startPage(pageRequestBean.getPageNum(),pageRequestBean.getLimit()).
                doSelectPageInfo(()->stockDetailMapper.findAllStockDetailBean(pageRequestBean, stockDetailBean));
    }

    @Override
    public int saveStockDetailBean(StockDetailBean stockDetailBean) {
        return stockDetailMapper.saveStockDetailBean(stockDetailBean);
    }
}
